"use strict";
cc._RF.push(module, 'd4fe4r1Zi5N5rJoMT9UZcHc', 'drawDetail');
// scripts/O1ModuleRes/control/o1DrawBoard/drawDetail.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var gameEngine_1 = require("../../../engines/gameEngine");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var drawDetail = /** @class */ (function (_super) {
    __extends(drawDetail, _super);
    function drawDetail() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.gdi = null;
        _this.lbTitleName = null;
        _this.m_drawInfo = null;
        return _this;
        // update (dt) {}
    }
    drawDetail.prototype.onLoad = function () {
    };
    drawDetail.prototype.start = function () {
    };
    drawDetail.prototype.setInfo = function (drawInfo) {
        this.m_drawInfo = drawInfo;
        this.lbTitleName.string = this.m_drawInfo.name;
        //
        this.OnShowGdi();
    };
    drawDetail.prototype.OnShowGdi = function () {
        for (var _i = 0, _a = this.m_drawInfo.drawList; _i < _a.length; _i++) {
            var data = _a[_i];
            var isStart = data.isStart, color = data.color, lineWidth = data.lineWidth, x = data.x, y = data.y;
            var r = color.r, g = color.g, b = color.b;
            this.gdi.lineWidth = lineWidth;
            this.gdi.strokeColor = cc.color(r, g, b);
            if (isStart) {
                this.gdi.moveTo(x - 1, y - 1);
                this.gdi.lineTo(x, y);
                this.gdi.stroke();
            }
            else {
                this.gdi.lineTo(x, y);
                this.gdi.stroke();
                this.gdi.moveTo(x, y);
            }
        }
    };
    drawDetail.prototype.OnBtnDelete = function () {
        gameEngine_1.default.emit('drawRecord.OnDeleteDraw', this.m_drawInfo.name);
    };
    drawDetail.prototype.OnBtnEdit = function () {
        gameEngine_1.default.emit('drawRecord.OnEditDraw', this.m_drawInfo.name);
    };
    __decorate([
        property(cc.Graphics)
    ], drawDetail.prototype, "gdi", void 0);
    __decorate([
        property(cc.Label)
    ], drawDetail.prototype, "lbTitleName", void 0);
    drawDetail = __decorate([
        ccclass
    ], drawDetail);
    return drawDetail;
}(cc.Component));
exports.default = drawDetail;

cc._RF.pop();